from config.model_config import get_base_open_ai, xin_qwen_model


# from langchain_openai import OpenAI
from openai import OpenAI

client = OpenAI(api_key="e440104944fe4defabccd2620e5dff6c.xj8mlkvxPdr0HYff", base_url='https://open.bigmodel.cn/api/paas/v4', model='glm-4-flash')

def chat_completions4(query):
    resp = client.chat.completions.create(

            messages=[
                {"role": "system", "content": "You are a helpful assistant."},
                {"role": "user", "content": query}
            ]
        )
    print(resp)
    print(resp.choices[0].message.content)
    for chunk in resp:
        print(chunk)

if __name__ == '__main__':
    chat_completions4("蒸一个包子要5分钟, 蒸5个要多少分钟")
